package com.kgame5.xtank3d.control {
import kgame5.enginex.EntityVO;
import kgame5.enginex.GameCommand;
import kgame5.kutil.T;

import com.kgame5.xtank3d.GameEnum;
import com.kgame5.xtank3d.model.shot.ShotEntity;
import com.kgame5.xtank3d.utils.LaneGenerator;
import com.kgame5.xtank3d.vo.MyTankVO;
import com.kgame5.xtank3d.vo.ShotVO;

/**
 * @author kk
 */
public class AddShotCommand extends GameCommand{
	public static const NAME:String="AddShotCommand";

	override public function execute(data:Object) : void {
		T.p(NAME);
		
		//坦克开炮动作,切换状态
		var tankVO:MyTankVO=data as MyTankVO;
		
		//添加炮弹,TODO 这个做成一个Command.
		//TODO ShotVO要由ShotVOFactory来做,它会从炮口发射炮弹
		var shotVO:ShotVO=new ShotVO();
		shotVO.id=EntityVO.GetNextFreeID();
		shotVO.cateID=GameEnum.CATEID_SHOT;
		shotVO.typeID=GameEnum.SHOTTYPE_DEFAULT_MID;
		shotVO.hardVO=LaneGenerator.genHardVO_Missile(tankVO, 12, 20, tankVO.input.mouse3DX, tankVO.input.mouse3DZ);
		gamePlay.addEntity(new ShotEntity(shotVO));
	}
}//end of class
}
